package flower.com.fenzu35011111.base;

import android.app.Application;

import com.zhy.http.okhttp.OkHttpUtils;

import java.util.concurrent.TimeUnit;

import flower.com.fenzu35011111.db.Z_Groups_Dao;
import okhttp3.OkHttpClient;

/**
 * 启动最新执行的一个类
 */
public class MyApplication extends Application {

    private static Application sInstance;


    @Override
    public void onCreate() {
        super.onCreate();
        sInstance = this;
        getokhttp();
        intdb();
    }

    private void intdb() {
        Z_Groups_Dao z_groups_dao = new Z_Groups_Dao(this);
        z_groups_dao.query();
    }


    public static Application getInstance() {
        return sInstance;
    }

    public void getokhttp() {
        OkHttpClient okHttpClient = new OkHttpClient.Builder()
//                .addInterceptor(new LoggerInterceptor("TAG"))
                .connectTimeout(30000L, TimeUnit.MILLISECONDS)
                .readTimeout(30000L, TimeUnit.MILLISECONDS)
                //其他配置
                .build();

        OkHttpUtils.initClient(okHttpClient);
    }

}
